<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>   
<!DOCTYPE html>
<!-- <script type="text/javascript" src="../../decorate/common/head.js"></script> -->
<html>
<head>
<jsp:include page="/common/head.jsp" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Insert title here</title>
</head>
<style type="text/css">

</style>
<body>
	<div id="login-container">
		<div class="login_header">
			<font>
				login....
			</font>
		</div>
		<div>
			<form action="${ctx}/loginCheck" method="POST" id="login_form">
				<span>用户名</span>
				<div>
					<input id="j_username" name="j_username" type="text" value="${sessionScope['SPRING_SECURITY_LAST_USERNAME']}"/>
				</div>
				<span>密码</span>
				<div>
					<input id="j_password" name="j_password" type="password" value="${sessionScope['SPRING_SECURITY_LAST_PASSWORD']}"/>
				</div>
					<span>验证码</span>
				<div>
					<input  type="text" id="j_validateCode" name="j_validateCode">
					<img id="cjpge" alt="看不清楚" src="${ctx}/login/cjpge.jpg" alt="点击更新验证码" title="点击更新验证码" onclick="imgClick()"/>
				</div>
				<div >
					<input class="btn btn-default"   type="submit" onclick="login_submit();" value="提交"/>
				</div>
			</form>
			<c:if test="${param.error == true}"> 
				<c:if test="${not empty SPRING_SECURITY_LAST_EXCEPTION.message}">
					 <font color="red"> 登录失败:
			    		<c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}" />
			    	</font>
				</c:if>    
	    	</c:if>
	   </div>
	</div>
</body>
<script type="text/javascript">
$(function(){
});
/**更新验证码事件*/
function imgClick(){
	$("#cjpge").attr("src","${ctx}/login/cjpge.jpg?d="+new Date().getTime());
}

function login_submit(){
	var u=$("#j_username").val();
	var p=$("#j_password").val();
	var c=$("#j_validateCode").val();
	p =CryptoJS.MD5(CryptoJS.MD5(CryptoJS.MD5(p)+u)+c)+""; //转码
	$("#j_password").val(p);
	$("#login_form").submit();
}

</script>	
</html>